<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //  数组转对象；
        // ['a', 'a', 'a', 'b', 'b', 'c', 'c', 'c', 'c', 'd', 'd', 'd', 'd']
        // -- - >
        let arr = ['a', 'a', 'a', 'b', 'b', 'c', 'c', 'c', 'c', 'd', 'd', 'd', 'd']
        let obj = {}
        for (let i = 0; i < arr.length; i++) {
            let key = arr[i]
         if (!obj[key]) {
             obj[key] = 1
         } else {
             obj[key] = obj[key] +1
         }
        }
            console.log(obj)
    </script>
</head>

<body>

</body>

</html>